<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改项目')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-previousCollection-edit">
        <input th:value="${obj.id}" id="id" name="id" class="form-control" type="hidden" />
        <h4 class="form-header h4">基本信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">工程公司：</label>
            <div class="col-sm-8">
                <select name="compId" id="compId" class="form-control noselect2">
                    <option value="">请选择</option>
                    <option th:each="pro:${userComp}"
                            th:selected="${obj.compId==pro.compId}"
                            th:value="${pro.compId}"
                            th:text="${pro.compName}"></option>

                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">项目名称：</label>
            <div class="col-sm-8">

                <input th:value="${obj.proName}" id="proName" name="proName" class="form-control" type="text" placeholder="请输入项目名称">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">工程负责人：</label>
            <div class="col-sm-8">
                <input th:value="${obj.gcPerson}" name="gcPerson" id="gcPerson" class="form-control" type="text" placeholder="请输入工程负责人">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">商务负责人：</label>
            <div class="col-sm-8">
                <input th:value="${obj.swPerson}" id="swPerson" name="swPerson" class="form-control" type="text" placeholder="请输入商务负责人">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">合同额：</label>
            <div class="col-sm-8">
                <input th:value="${obj.contractAmount}" id="contractAmount" name="contractAmount" class="form-control" type="text" placeholder="请输入合同额">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">往期回款<span style="color: red">(万元)</span>：</label>
            <div class="col-sm-8">
                <input th:value="${obj.previousCollection}" id="previousCollection" name="previousCollection" class="form-control" type="text"
                       placeholder="请输入往期回款">
            </div>
        </div>


    </form>
    <th:block th:include="include :: footer"/>
    <th:block th:include="include :: datetimepicker-js"/>
    <th:block th:include="include :: select2-js"/>
    <script type="text/javascript">
        var prefix = ctx + "previousCollection";
        var data;

        function submitHandler() {
            data = {
                "id": $("#id").val(),
                "compId": $("#compId").val(),
                "proName": $("#proName").val(),
                "gcPerson": $("#gcPerson").val(),
                "swPerson": $("#swPerson").val(),
                "contractAmount": $("#contractAmount").val(),
                "previousCollection": $("#previousCollection").val(),
            }
            if ($("#compId").val() == "" || $("#proName").val() == "") {
                alert("请填写工程公司或者项目名称！");
            } else {
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</div>
</body>
</html>